package org.bird.jvm;

/**
 * @Described：新生代Eden区分配优先探究 
 * @VM args : -Xms20M -Xmx20M -Xmn10M -XX:SurvivorRatio=8 -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+UseParNewGC
 * 限制java堆大小为20M，年轻代为10M，Eden为8M，两个survivor分别为1M 
 * @author liangjf
 *
 */
public class Allocation {

	private static final int _1MB = 1024 * 1024;
	
	@SuppressWarnings("unused")
	public static void main(String[] args) {
		 byte[] allocation1, allocation2, allocation3, allocation4;  
	        allocation1 = new byte[2 * _1MB];  
	        System.out.println("allocation1 over");  
	        allocation2 = new byte[2 * _1MB];  
	        System.out.println("allocation2 over");  
	        allocation3 = new byte[2 * _1MB];  
	        System.out.println("allocation3 over");  
	        allocation4 = new byte[4 * _1MB];  // 出现一次Minor GC  
	        System.out.println("allocation4 over");  
	}
}
